#include <xp/bas/string.h>
#include <xp/bas/stdio.h>

int xp_main (int argc, xp_char_t* argv[])
{
	const xp_char_t* p;

	if (argc != 3) {
		xp_printf (XP_TEXT("usage: %s string needle\n"), argv[0]);
		return -1;
	}	

	p = xp_strpbrk (argv[1], argv[2]);
	if (p == XP_NULL) p = XP_TEXT("(NULL)");
	xp_printf (XP_TEXT("xp_strpbrk (%s, %s) = %s\n"), argv[1], argv[2], p);

	p = xp_strxpbrk (argv[1], xp_strlen(argv[1]), argv[2]);
	if (p == XP_NULL) p = XP_TEXT("(NULL)");
	xp_printf (XP_TEXT("xp_strxpbrk (%s, %lu, %s) = %s\n"),
		argv[1], (unsigned long)xp_strlen(argv[1]), argv[2], p);

	p = xp_strnpbrk (argv[1], argv[2], xp_strlen(argv[2]));
	if (p == XP_NULL) p = XP_TEXT("(NULL)");
	xp_printf (XP_TEXT("xp_strnpbrk (%s, %s, %lu) = %s\n"),
		argv[1], argv[2], (unsigned long)xp_strlen(argv[2]),  p);

	p = xp_strxnpbrk (argv[1], xp_strlen(argv[1]), argv[2], xp_strlen(argv[2]));
	if (p == XP_NULL) p = XP_TEXT("(NULL)");
	xp_printf (XP_TEXT("xp_strxnpbrk (%s, %lu, %s, %lu) = %s\n"),
		argv[1], (unsigned long)xp_strlen(argv[1]), 
		argv[2], (unsigned long)xp_strlen(argv[2]),  p);

	return 0;
}
